package com.hengfoxwolf.ffmpegdemo
import android.os.Bundle
import android.provider.MediaStore.Video
import android.util.Log
import android.view.View
import com.hengfoxwolf.ffmpegdemo.base.BaseActivity
import com.hengfoxwolf.ffmpegdemo.databinding.ActivityMainBinding

class MainActivity : BaseActivity<ActivityMainBinding>(ActivityMainBinding::inflate),View.OnClickListener {

    override fun init(savedInstanceState: Bundle?) {
        mBinding.view1.setOnClickListener(this)
        mBinding.view2.setOnClickListener(this)

        mBinding.view9.setOnTouchListener { v, event ->
            Log.d(TAG, "view2.setOnTouchListener")
            return@setOnTouchListener true
        }
        mBinding.view9.setOnClickListener {
            Log.d(TAG, "view2.setOnClickListener")
        }
        mBinding.view9.setOnLongClickListener {
            Log.d(TAG, "view2.setOnLongClickListener")
            return@setOnLongClickListener true
        }

        mBinding.view10.setOnTouchListener { v, event ->
            Log.d(TAG, "view3.setOnTouchListener")
            return@setOnTouchListener false
        }
        mBinding.view10.setOnClickListener{
            Log.d(TAG, "view3.setOnClickListener")
        }
        mBinding.view10.setOnLongClickListener {
            Log.d(TAG, "view3.setOnLongClickListener")
            return@setOnLongClickListener true
        }


        mBinding.view4.setOnClickListener(this)
        mBinding.view5.setOnClickListener(this)
        mBinding.view6.setOnClickListener(this)
        mBinding.view7.setOnClickListener(this)
        mBinding.view8.setOnClickListener(this)
        mBinding.view9.setOnClickListener(this)
        mBinding.view10.setOnClickListener(this)
    }

    override fun onClick(view: View?) {
        when (view?.id) {
            R.id.view1 -> {
                startActivity<AudioPlayActivity>()
            }
            R.id.view2 -> {
                startActivity<VideoPlayActivity>()
            }
            R.id.view3 -> {

            }
            R.id.view4 -> {
                startActivity<FlowCaseActivity>()
            }
            R.id.view5 -> {

            }
            R.id.view6 -> {

            }
            R.id.view7 -> {

            }
            R.id.view8 -> {

            }
            R.id.view9 -> {

            }
            R.id.view10 -> {

            }
        }
    }

    companion object {
        const val TAG = "MainActivity"
    }
}